<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>{$current['title']}-{$Think.CONFIG.sitename}</title>

    <link href="__PUBLIC__/static/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="__PUBLIC__/static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/static/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="__PUBLIC__/static/css/animate.min.css" rel="stylesheet">
    <include file="Public/commoncss" />
    <link href="__PUBLIC__/static/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
</head>

<body class="gray-bg top-navigation">
<div id="wrapper">
    <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom white-bg">
            <include file="Public/header" />
        </div>
        <div class="wrapper wrapper-content">
            <div class="row">
                <div class="col-sm-3">
                    <div class="ibox float-e-margins">
                        <include file="Public/deptnav" />
                    </div>
                </div>
                <div class="col-sm-9 animated fadeInRight">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title"><h4>{$current['title']}</h4></div>
                        <div class="ibox-content">
                            <form class="form-horizontal m-t" action="{:U('update')}" id="myForm">
                                <input type="hidden" name="id" value="{$data.id}">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">部门名称：</label>
                                    <div class="col-sm-10">
                                        <input  name="name" class="form-control" type="text" value="{$data.name}" datatype="*3-16" placeholder="部门名称：总部"  nullmsg="请填写部门名称！" errormsg="部门名称3-16个字符！" sucmsg="部门名称验证通过！" autocomplete="off">
                                        <span class="help-block m-b-none Validform_checktip"></span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">上级部门：</label>
                                    <div class="col-sm-10">
                                        <select class="form-control m-b" name="pid">
                                            <option value="0">总管部门</option>

                                            {$department}

                                        </select>
                                        <span class="help-block m-b-none Validform_checktip"></span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">部门介绍：</label>
                                    <div class="col-sm-10">
                                        <textarea name="content" id="content" style="width:100%;height:400px;visibility:hidden;">{$data.content}</textarea>
                                        <span class="help-block m-b-none Validform_checktip"></span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-10 col-sm-offset-3">
                                            <button class="btn btn-primary" type="submit">保存内容</button>
                                            <span class="help-block m-b-none " id="dump"></span>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        <include file="Public/footer" />
    </div>
</div>
<include file="Public/commonjs" />
<script src="__PUBLIC__/static/js/bootstrap.min.js?v=3.3.5"></script>
<script src="__PUBLIC__/static/js/content.min.js?v=1.0.0"></script>
<script src="__PUBLIC__/static/js/plugins/validate/Validform_v5.3.2.js"></script>
<script charset="utf-8" src="__PUBLIC__/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="__PUBLIC__/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        var editor = KindEditor.create('textarea[name="content"]',{
            uploadJson : '__PUBLIC__/kindeditor/php/upload_json.php',
            fileManagerJson : '__PUBLIC__/kindeditor/php/file_manager_json.php',
            allowFileManager : true,
            afterBlur:function(){this.sync();}
        });
        //提交表单
        $("#myForm").Validform({
            tiptype:function(msg,o,cssctl){
                if(!o.obj.is("form")){
                    var objtip=o.obj.siblings(".Validform_checktip");
                    cssctl(objtip,o.type);
                    objtip.text(msg);
                }else{
                    if(msg == '恭喜,操作成功！'){
                        window.location.href="{:U('Department/index')}";
                    }else{
                        var objtip=o.obj.find("#dump");
                        cssctl(objtip,o.type);
                        objtip.text(msg);
                    }
                }
            },
            ajaxPost:true
        });
    })
</script>
</body>

</html>